package de.koller.balance.scene.planet;

import de.koller.aframe.util.math.FunctionPreview;
import de.koller.aframe.util.math.IFunction;
import de.koller.aframe.util.math.IFunction2D;
import de.koller.aframe.util.math.SphereUtil;

public class SphereTextureBounds implements IFunction, IFunction2D {

	private final IFunction2D sphere = SphereUtil.INSTANCE;
	
	@Override
	public float getValue( float x ) {
		float u = (float)(2. * 1. * Math.PI);
		float a = (float)((x / u) * Math.PI*2.);
		float r = (float)Math.sin( a );
		return (float)(r * Math.PI) / 4f;
	}

	@Override
	public float getValue( float x, float y ) {
		if( x == 0 )
			return 1;
		return 0;
	}
	
	public static void main( String[] args ) {
		FunctionPreview.dontscale( -0.1f );
		FunctionPreview.showFunction( -3.5f, 3.5f, new SphereTextureBounds() );
	}
	
}
